/* ***********************
 * Version: MPL 1.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is briefAuthors.js module.
 *
 * The Initial Developer of the Original Code is Rob Gerns.
 *
 * Portions created by the Initial Developer are Copyright (C) 2011
 * the Initial Developer. All Rights Reserved.
 *
 **************************/
function getBriefAuthors(objXmlDocument) {
    /*************************************************
    * Function Name(s): getBriefAuthors
    * 
    * Purpose: Check to see if there are any authors defined in the 
    * 'brief' section of the Oister file.  If so retrieve the value
    * of each.
    ****************************/	
    var objBriefAuthors = objXmlDocument.getElementsByTagName("authors");
    var objBriefAuthorsNode = "";
    var intBriefAuthorsCount = objBriefAuthors.length;
    var intCounter = 0;
    var intCounterTwo = 0;
    var strBriefAuthors = "";
    
    if (objBriefAuthors !== undefined && intBriefAuthorsCount > 0) {
        for (intCounter = 0; intCounter < objBriefAuthorsCount; intCounter++) {
            objBriefAuthorsNode = objBriefAuthors[0].childNodes[intCounter+1]; 
            //Check to see if the node is in fact an "authorsName" node.
            if (objBriefAuthorsNode.nodeName === "authorName") {
                for (intCounterTwo = 0; intCounterTwo < intBriefAuthorsCount;
                    intCounterTwo++) {
                    strBriefAuthors = objBriefAuthorsNode.firstChild.nodeValue;
                    writeBriefAuthors(strBriefAuthors, intCounterTwo);
		            }
            }	
        }	
    }
} 
function writeBriefAuthors(strBriefAuthors, intCounterTwo) {
    /*************************************************
    * Function Name(s): writeBriefAuthors
    * 
    * Purpose: Create the appropriate div for the authors
    * listed in the brief section of the Oister XML.
    ****************************/     
    var objDivBriefAuthors = "";
    var objDivBriefAuthorsId = "";
    
    objDivBriefAuthors = document.createElement("div");
    document.getElementById('begin').appendChild(objDivBriefAuthors);
    objDivBriefAuthorsId = objDivBriefAuthors.id = "authors" + intCounterTwo;
    objDivBriefAuthors.className = "authors";
    objDivBriefAuthors.innerHTML = strBriefAuthors;
}